{include_core file="lib/header.html" title="商品评价"}
{include_core file="lib/top_nav.html"}
    <div id="container" class="inner clearfix">
      <div class="crumbs"><a href="{AnUrl()}">首页</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="javescript:void(0)">全部评论</a></div>
      <div class="all-comment clearfix">
        <div class="comment-aside">
          <div class="current-product">
            {$cover = _uri('attachment', $goods_info.cover, 'path')}
            <span class="img-box"><img src="{_image($cover)}" width="220" height="220"></span>
            <h2 class="tit"><a href="{AnUrl("goods/{$goods_info.id}")}">{$goods_info.title}</a></h2>
            <p class="price">{$goods_info.price}元</p>
          </div>
          <!--end current-product-->
          <div class="looked-product">
            {*<div class="top"><h2>看过的商品评价</h2></div>
            <div class="list">
              <dl class="clearfix">
                <dt><img src="../images/looked-product.png" width="80" height="80"></dt>
                <dd>
                  <h2 class="tit"><a href="###">NBD智能水杯 银白色</a></h2>
                  <p class="price">￥169</p>
                  <p class="star"><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a></p>
                </dd>
              </dl>
              <dl class="clearfix">
                <dt><img src="../images/looked-product.png" width="80" height="80"></dt>
                <dd>
                  <h2 class="tit"><a href="###">NBD智能水杯 银白色</a></h2>
                  <p class="price">￥169</p>
                  <p class="star"><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a></p>
                </dd>
              </dl>
              <dl class="clearfix">
                <dt><img src="../images/looked-product.png" width="80" height="80"></dt>
                <dd>
                  <h2 class="tit"><a href="###">NBD智能水杯 银白色</a></h2>
                  <p class="price">￥169</p>
                  <p class="star"><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a></p>
                </dd>
              </dl>
              <dl class="clearfix">
                <dt><img src="../images/looked-product.png" width="80" height="80"></dt>
                <dd>
                  <h2 class="tit"><a href="###">NBD智能水杯 银白色</a></h2>
                  <p class="price">￥169</p>
                  <p class="star"><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a><a href="###"></a></p>
                </dd>
              </dl>
            </div>*}
          </div>
          <!--looked-product-->
        </div>
        <!--end comment-aside-->
        <div class="comments-block clearfix">
          {if $comment_list}
          <div class="top clearfix">
            <div class="box left clearfix">
              <div class="rate-box">
                {$ratio = comment_helper::get_comment_ratio($goods_info.id)}
                <span class="rate"><em>{$ratio}</em>%</span>
                <p>五星评价率</p>
              </div>
              <ul class="star-ul">
              {for $a=1 to 5}
                <li><span class="star">
                {for $b=1 to 6-$a}
                  <a href="javascript:void(0);"></a>
                {/for}
                {for $b=1 to $a-1}
                  <a href="javascript:void(0);" class="disabled"></a>
                {/for}
                {$star = comment_helper::get_count_comment($goods_info.id, 6-$a)}
                </span><span class="num">{$star}人</span></li>
              {/for}
              </ul>
            </div>
            <div class="box box2 right">
              {$label = comment_helper::get_comment_label(6)}
              {foreach $label as $k=>$v}
              <a href="javascript:void(0);">{$v.title}</a>
              {/foreach}
            </div>
          </div>
          {/if}
          <!--end top-->
          <div class="list">
            {foreach $comment_list as $k=>$v}
              <dl class="clearfix">
                  <dt>
                    {$cover = user_helper::avatar($v.user_id)}
                    {$name =user_helper::display_name($v.user_id)}
                    <span class="user-img"><img src="{$cover}" width="80" height="80"></span>
                    <span class="user-name">{$name}</span>
                  </dt>
                  <dd>
                    <p class="star">
                      {for $a=1 to $v.star}
                      <a href="###"></a>
                      {/for}
                    </p>
                    <p class="con">{$v.title}</p>
                    <div class="picture-box">
                      <ul class="clearfix">
                        {$img = comment_helper::get_comment_img($v.id)}
                        {foreach $img as $k1=>$v1}
                        <li><img src="{_image($v1.path)}" height="90"></li>
                        {/foreach}
                      </ul>
                    </div>
                    {$official_list = comment_helper::get_official_list($v.id)}
                    {$count_official = comment_helper::get_count_official($v.id)}
                    {$count_comment_user1 = comment_helper::get_comment_user($v.id, 1)}
                    {$count_comment_user2 = comment_helper::get_comment_user($v.id, 2)}
                    <p class="useful clearfix"><span class="left" data-comment_id="{$v.id}" data-user_id="{$user_id}">此评价是否有用？<a href="javascript:void(0)" class="js_comment_user {if !$user_id}checkLoginBox{/if}" data-status="1" data-num="{$count_comment_user1}">有用（{$count_comment_user1}）</a><a href="javascript:void(0)" class="js_comment_user {if !$user_id}checkLoginBox{/if}" data-status="2" data-num="{$count_comment_user1}">没用（{$count_comment_user2}）</a></span><a href="###" class="reply-btn">回复（{$count_official}）</a></p>
                    {foreach $official_list as $k1=>$v1}
                    <div class="official-reply">
                      <span class="name">官方回复：</span>
                      <p class="reply-con">{$v1.title}</p>
                    </div>
                    {/foreach}
                  </dd>
              </dl>
              {/foreach}
          </div>
          <!--end list-->
          {include_core file="lib/page_fav.html"}
          <!--page-box  end-->
        </div>
        <!--end comment-block-->
        
      </div>
      <!--end all-comment-->
    </div>
    <!--end container-->
<script>
$(function(){
  $('.js_comment_user').click(function(){
      var thisBtn = $(this);
      var status = thisBtn.data('status');
      var commentId = thisBtn.parent().data('comment_id');
      var userId = thisBtn.parent().data('user_id');
      var num = thisBtn.data('num');
      var newNum = num + 1;
      $.post(
          siteUrl+'/comment/comment_user',
          { comment_id:commentId, user_id:userId, comment_status:status },
          function(data){
            if (data.info == 'ok') {
              if (status == 1) {
                var html = '有用（'+newNum+'）';
              } else {
                var html = '没用（'+newNum+'）';
              }
              thisBtn.html(html);
            }
          },
          'json'
      );
    })
})
</script>
 {include_core file="lib/footer.html"}